<!--
 * @Description: Vuex 使用
 * @Version: @1.0.0
 * @Autor: YJY
 * @Date: 2021-07-14 13:49:51
 * @LastEditors: YJY
 * @LastEditTime: 2021-07-20 16:01:00
-->
<template>
  <div class="home">
    <h2>我的年龄是：{{$store.state.age}} <br><button @click="$store.state.age++">响应</button></h2>
    <h2>我的年龄是：{{$store.getters.changeAge}}</h2>
    <h2>我的年龄是：{{$store.getters.changeAge}}</h2>
    <button @click="$store.commit('addAge',10)">同步增加</button>
    <button @click="$store.dispatch('ayAddAge',10)">异步增加</button>
  </div>
</template>

<script>

export default {
  name: 'Home',
  mounted () {
    // console.log(this.$store)
  }
}
</script>
